from sqlalchemy import Column, String

from apps.db import BaseModel, Integer


class BankSideExtendInfo(BaseModel):
    """合同拓展信息"""
    __tablename__ = 'tb_bank_side_extend'
    contract_id = Column(String, comment='关联bankSideInfo')
    contract_no = Column(String, comment='关联3.0系统中合同编号')
    contract_start_date = Column(String, comment='履行期限开始时间')
    contract_end_date = Column(String, comment='履行期限结束时间')
    dyqr_tel = Column(String, comment='抵押权人电话')
    total_price = Column(String, comment='评估价格')
    contract_amt = Column(String, comment='权利价格')
    house_cert_no = Column(String, comment='房屋产权证书')
    dkfs = Column(String, comment='贷款方式')
    dyfs = Column(String, comment='抵押方式')
    dysw = Column(String, comment='抵押顺位')
    dbfw = Column(String, comment='担保范围')
    zmdj = Column(String, comment='证明登记')
    dbbz = Column(String, comment='登薄备注')
    house_located = Column(String, comment='房屋坐落')
    house_whole_located = Column(String, comment='详细坐落信息')
    build_marea = Column(String, comment='建筑面积')
    is_combo = Column(String, comment='是否组合贷')
    qlr = Column(String, comment='抵押权人姓名')
    qlr_cert_no = Column(String, comment='抵押权人证件号')
    dy_method = Column(String, comment='抵押方式')
    loan_method = Column(String, comment='贷款方式')
    collat_id = Column(String, comment='抵押物id')

    def __init__(self, *args, **kwargs):
        super(BankSideExtendInfo, self).__init__()
        for attr, value in kwargs.items():
            if attr in self.__column_name_list__() and getattr(self, attr) is None:
                setattr(self, attr, value)
